package servlet;

import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import db.DB;

public class RegisterServlet extends HttpServlet {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		request.setCharacterEncoding("gb2312");
		response.setCharacterEncoding("gb2312");
		String username = request.getParameter("username");
		String pwd = request.getParameter("pwd");
		if (new DB().insertUser(username, pwd)) {
			response.sendRedirect("login.jsp");

		}
	}

	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		doGet(request, response);
	}

}
